﻿<navigation:Page x:Class="QSHC.QSchedule.Silverlight.Views.BookingAppointmentPage" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
           xmlns:custom="clr-namespace:QSHC.CustomControl;assembly=QSHC.CustomControl"
           xmlns:vm="clr-namespace:QSHC.QSchedule.Silverlight.ViewModels"
           xmlns:converter="clr-namespace:QSHC.QSchedule.Silverlight.Converters"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="970" d:DesignHeight="800" Language="th-TH"
           Title="BookingAppointmentPage">
    
    <navigation:Page.Resources>
        <vm:BookingAppointmentViewModel x:Key="bookingAppointmentViewModel" />
        <converter:PhysicianToTextConverter x:Key="physicianToTextConverter" />
    </navigation:Page.Resources>

    <Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource bookingAppointmentViewModel}}">
        <StackPanel Margin="0,0,0,-12">
            <StackPanel Orientation="Horizontal" Margin="5,5,0,0">
                <TextBlock Text="HN:" Style="{StaticResource TextBlockStyle}" Width="80" TextAlignment="Right" />
                <TextBox Width="120" Text="{Binding Path=SelectedPatientHN, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}" Margin="5,0,0,0" Name="HNTextBox" />
                <TextBlock Text="{Binding Path=PatientDetail}" Style="{StaticResource TextBlockStyle}" Margin="10,0,0,0" />
            </StackPanel>
            <Grid Margin="5,5,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="350" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <StackPanel Grid.Column="0">
                    <StackPanel Orientation="Horizontal" >
                        <TextBlock Text="หน่วยบริการ:" Style="{StaticResource TextBlockStyle}" Width="80" TextAlignment="Right" />
                        <ComboBox Width="250" Margin="5,0,0,0" ItemsSource="{Binding Path=Services}" DisplayMemberPath="Name" SelectedItem="{Binding Path=SelectedService, Mode=TwoWay}" Style="{StaticResource ComboBoxStyle}" Name="LocationComboBox" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                        <TextBlock Text="แพทย์:" Style="{StaticResource TextBlockStyle}" TextAlignment="Right" Width="80" />

                        <custom:AutoCompleteComboBox x:Name="PhysicianACCB" 
                                                     ItemsSource="{Binding Path=Physicians}" Width="250" 
                                                     SelectedItem="{Binding Path=SelectedPhysician, Mode=TwoWay}"
                                                     MaxDropDownHeight="200" 
                                                     Margin="5,0,0,0" Height="25" FontFamily="Tahoma" FontSize="14" Text="{Binding Path=SelectedPhysicianText, Mode=TwoWay}">
                            <custom:AutoCompleteComboBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <TextBlock Text="{Binding EmployeeCode, Converter={StaticResource physicianToTextConverter}}" />
                                    </StackPanel>
                                </DataTemplate>
                            </custom:AutoCompleteComboBox.ItemTemplate>
                        </custom:AutoCompleteComboBox>
                    </StackPanel>
                   
                    <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                        <TextBlock Text="นัด:" Style="{StaticResource TextBlockStyle}" Width="80" TextAlignment="Right" />
                        <ComboBox x:Name="AppointmentValueComboBox" Style="{StaticResource ComboBoxStyle}" Width="50" Margin="5,0,0,0" SelectedIndex="{Binding Path=SelectedDayIndex, Mode=TwoWay}">
                            <ComboBoxItem Content="1" />
                            <ComboBoxItem Content="2" />
                            <ComboBoxItem Content="3" />
                            <ComboBoxItem Content="4" />
                            <ComboBoxItem Content="5" />
                            <ComboBoxItem Content="6" />
                            <ComboBoxItem Content="7" />
                            <ComboBoxItem Content="8" />
                            <ComboBoxItem Content="9" />
                            <ComboBoxItem Content="10" />
                            <ComboBoxItem Content="11" />
                            <ComboBoxItem Content="12" />
                            <ComboBoxItem Content="13" />
                            <ComboBoxItem Content="14" />
                            <ComboBoxItem Content="15" />
                            <ComboBoxItem Content="16" />
                            <ComboBoxItem Content="17" />
                            <ComboBoxItem Content="18" />
                            <ComboBoxItem Content="19" />
                            <ComboBoxItem Content="20" />
                            <ComboBoxItem Content="21" />
                            <ComboBoxItem Content="22" />
                            <ComboBoxItem Content="23" />
                            <ComboBoxItem Content="24" />
                            <ComboBoxItem Content="25" />
                            <ComboBoxItem Content="26" />
                            <ComboBoxItem Content="27" />
                            <ComboBoxItem Content="28" />
                            <ComboBoxItem Content="29" />
                            <ComboBoxItem Content="30" />
                            <ComboBoxItem Content="31" />
                            <ComboBoxItem Content="32" />
                            <ComboBoxItem Content="33" />
                            <ComboBoxItem Content="34" />
                            <ComboBoxItem Content="35" />
                            <ComboBoxItem Content="36" />
                        </ComboBox>
                        <ComboBox x:Name="AppointmentTypeComboBox" Style="{StaticResource ComboBoxStyle}" Width="80" Margin="5,0,0,0" SelectedIndex="{Binding Path=SelectedDurationIndex, Mode=TwoWay}">
                            <ComboBoxItem Content="วัน" />
                            <ComboBoxItem Content="สัปดาห์" />
                            <ComboBoxItem Content="เดือน" />
                            <ComboBoxItem Content="ปี" />
                        </ComboBox>
                        <Button x:Name="SearchButton" Content="ค้นหา" Width="65" Margin="5,0,0,0" Style="{StaticResource ButtonStyle}" Command="{Binding Path=SearchCommand}" />
                    </StackPanel>

                    <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                        <TextBlock Text="เวลา:" Style="{StaticResource TextBlockStyle}" Width="80" TextAlignment="Right" />
                        <TextBox Width="50" Text="{Binding Path=AppointmentTime, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}" Margin="5,0,0,0" />
                        <TextBlock Text="น. (กำหนดเองได้)" Style="{StaticResource TextBlockStyle}" Margin="5,0,0,0" />
                    </StackPanel>

                    <toolkit:GlobalCalendar RenderTransformOrigin="0,0" HorizontalAlignment="Left" Margin="5,10,5,5" Height="Auto" Name="ScheduleCalendar" SelectedDate="{Binding Path=SelectedDate, Mode=TwoWay}" Width="210" FontFamily="Tahoma">
                        <toolkit:GlobalCalendar.RenderTransform>
                            <CompositeTransform ScaleX="1.5" ScaleY="1.5"/>
                        </toolkit:GlobalCalendar.RenderTransform>
                    </toolkit:GlobalCalendar>
                    <StackPanel Orientation="Horizontal" Margin="0,85,0,0">
                        <TextBlock Text="{Binding SelectedDate, StringFormat=\{0:D\}}" Style="{StaticResource TextBlockStyle}" HorizontalAlignment="Left" Margin="10,0,0,0" Width="200" />
                        <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="5,0,0,0">
                            <TextBlock Style="{StaticResource TextBlockStyle}" Text="โควต้า" HorizontalAlignment="Left" Margin="0,0,4,0" />
                            <TextBlock Style="{StaticResource TextBlockStyle}" Text="(" HorizontalAlignment="Left" Margin="0" />
                            <TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding Path=AppointedNumber}" HorizontalAlignment="Left" Margin="4,0" />
                            <TextBlock Style="{StaticResource TextBlockStyle}" Text="/" Margin="0" d:LayoutOverrides="Width" />
                            <TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding Quota}" HorizontalAlignment="Right" Margin="4,0" />
                            <TextBlock Style="{StaticResource TextBlockStyle}" Text=")" HorizontalAlignment="Right" Margin="0" />
                        </StackPanel>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="10,0,0,0">
                        <TextBlock Style="{StaticResource TextBlockStyle}" Name="TextBlockWeek" Height="25" Text="{Binding Path=SumWeek}" />
                    </StackPanel>
                </StackPanel>
                <StackPanel Grid.Column="1">
                    <StackPanel>
                        <StackPanel>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="220"/>
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                
                                <StackPanel>
                                    <TextBlock Text="ประเภทการนัด" Style="{StaticResource TextBlockStyle}" TextAlignment="Center" FontWeight="Bold" />
                                    <RadioButton GroupName="Appointment" Content="นัดติดตามการรักษา (Follow up)" Style="{StaticResource RadioButtonStyle}" IsChecked="{Binding Path=PreOrders.Type_FollowUp, Mode=TwoWay}" Margin="5,0,0,0" />
                                    <RadioButton GroupName="Appointment" Content="นัดติดตามหลังผ่าตัด" Style="{StaticResource RadioButtonStyle}" IsChecked="{Binding Path=PreOrders.Type_Operate, Mode=TwoWay}" Margin="5,0,0,0" />
                                    <RadioButton GroupName="Appointment" Content="นัดนอนโรงพยาบาล (Admission)" Style="{StaticResource RadioButtonStyle}" IsChecked="{Binding Path=PreOrders.Type_Admission, Mode=TwoWay}" Margin="5,0,0,0" />
                                    <RadioButton GroupName="Appointment" Content="นัดรับยาไม่พบแพทย์" Style="{StaticResource RadioButtonStyle}" IsChecked="{Binding Path=PreOrders.Type_RecieveDrug, Mode=TwoWay}" Margin="5,0,0,0" />
                                   
                                </StackPanel>
                                <StackPanel Grid.Column="1">
                                    <TextBlock Text="คำแนะนำ" Style="{StaticResource TextBlockStyle}" TextAlignment="Center" FontWeight="Bold" />
                                    <CheckBox Content="ไม่งดอาหารและน้ำ" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Ins_Instruction1, Mode=TwoWay}" Margin="5,0,0,0" />
                                    <CheckBox Content="งดน้ำงดอาหารหลัง 2 ทุ่ม" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Ins_Instruction2, Mode=TwoWay}" Margin="5,0,0,0" />
                                    <CheckBox Content="งดน้ำงดอาหารหลังเที่ยงคืน" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Ins_Instruction3, Mode=TwoWay}" Margin="5,0,0,0" />
                                    <CheckBox Content="กรุณายืนใบนัดเพื่องลงทะเบียนที่ห้องบัตร ช่อง 18 และ 19" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Ins_Instruction4, Mode=TwoWay}" Margin="5,0,0,0"/>
                                    <CheckBox Content="ผู้ถือบัตรทองกรุณาขอใบส่งตัวมาใหม่" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Ins_Instruction5, Mode=TwoWay}" Margin="5,0,0,0" />
                                    <CheckBox Content="กรุณานำยาเดิมและผลการตรวจต่างๆ (ถ้ามี) มาด้วย" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Ins_Instruction6, Mode=TwoWay}" Margin="5,0,0,0"/>
                                </StackPanel>
                            </Grid>
                        </StackPanel>
                        
                        <StackPanel >
                            <TextBlock Text="การตรวจ" Style="{StaticResource TextBlockStyle}" TextAlignment="Left" Margin="70,0,0,0"   FontWeight="Bold" />
                            <CheckBox Content="นัดเจาะเลือด (Blood for examination)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_Lab, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="ตรวจคลื่นไฟฟ้าหัวใจ (EKG)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_EKG, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="เอ็กซเรย์ (X-ray)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_Xray, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="ABPM" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_ABPM, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="เอ็คโค่ (Echo S/P)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_Echo, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="Dobutamine stress echocardiography" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_Dobu, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="Tilt Table Test (TTT)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_TTT, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="Transthoracic echocardiography (TTE)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_TTE, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="Transesophygeal echocardiography (TEE)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_TEE, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="Postoperative echocardiography" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_Postop, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="Echo วัน admit" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_EchoAdmission, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="ทดสอบสมรรถภาพหัวใจ:เดินสายพาน (Exereise Stress Test)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_EST, Mode=TwoWay}" Margin="5,0,0,0"/>
                            <CheckBox Content="นัดมาฉีดสี (Cardiac Cathorization)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_Catheterization, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="ขยายหลอดเลือดด้วยบอลลูน (PCI)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_PCI, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="ติดเครื่องตรวจติดตามการทำงานหัวใจ 24 ชั่วโมง (24 hour Holter monitoring)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_Holter24, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="ติดเครื่องตรวจติดตามการทำงานหัวใจ 48 ชั่วโมง (48 hour Holter monitoring)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_Holter48, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="ขยายลิ้นหัวใจด้วยบอลลูน (PBMV)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_PBMV, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="จี้ไฟฟ้า (RF/EP Abration)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_RF, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="ทำเส้นฟอกไต (AVF)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_AVF, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="ใส่เครื่องกระต้นหัวใจ (pacemaker/AICD )" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_Pacemaker, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="นัดมาเช็คเครื่องกระตุ้นหัวใจ (Check pacemaker)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_CheckPacemaker, Mode=TwoWay}" Margin="5,0,0,0" />
                            <CheckBox Content="ประชุมปรึกษาเพื่องจองคิวผ่าตัด (Cardiac Conference)" Style="{StaticResource CheckBoxStyle}" IsChecked="{Binding Path=PreOrders.Inv_Conference, Mode=TwoWay}" Margin="5,0,0,0" />
                        </StackPanel>
                            
                        <StackPanel>
                            <TextBlock Text="Remark:" Style="{StaticResource TextBlockStyle}" Margin="5,0,0,0" />
                            <TextBox TextWrapping="Wrap" Height="100" Text="{Binding Path=Remark, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}" />
                        </StackPanel>

                    </StackPanel>
                </StackPanel>

            </Grid>
            <Button Content="บันทึก" Style="{StaticResource ButtonStyle}" Width="60" Command="{Binding Path=AddCommand}" FontWeight="Bold" Margin="0,10,0,0" Cursor="Hand" />
        </StackPanel>
    </Grid>
</navigation:Page>
